<template>
  <img :src="src" @click="previewImage(src)" class="img" alt="">
</template>
<script>
import { api as viewerApi } from "v-viewer";
import "viewerjs/dist/viewer.css";
export default {
  name: "GlImage",
  props: {
    src: {
      type: String,
      default: "",
    },
  },
  data() {
    return {};
  },
  created() {
    console.log(this.src);
  },
  mounted() {},
  methods: {
    // 预览图片
    previewImage(url) {
      let list = [url];
      viewerApi({
        images: list,
        options: {
          zIndex: 99999,
        },
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.img {
  cursor: pointer;
}
</style>